unit Border;

interface

uses
  System.Windows.Forms, Settings, System.Drawing;

type
  TBorder = class(System.Windows.Forms.Label)
  private
    { Private Declarations }
  public
    constructor Create(direction : String; top : Integer; left : Integer; width : Integer; height : Integer);
  end;

implementation

constructor TBorder.Create(direction : String;  top : Integer; left : Integer; width : Integer; height : Integer);
begin
  inherited Create;

  if (direction = 't') then
  begin
    self.Top := (top * TSettings.BlockHeight) - TSettings.BorderWidth;
    self.Height := TSettings.BorderWidth;
    self.Left := (left * TSettings.BlockWidth);
    self.Width := (width * TSettings.BlockWidth);
  end
  else if (direction = 'b') then
  begin
    self.Top := ((top + 1) * TSettings.BlockHeight);
    self.Height := TSettings.BorderWidth;
    self.Left := (left * TSettings.BlockWidth);
    self.Width := (width * TSettings.BlockWidth);
  end
  else if(direction = 'l') then
  begin
    self.Top := (top * TSettings.BlockHeight) - TSettings.BorderWidth;
    self.Height := ((height + 1) * TSettings.BlockWidth) - TSettings.BorderWidth;
    self.Left := (left * TSettings.BlockWidth) - TSettings.BorderWidth;
    self.Width := TSettings.BorderWidth;
  end
  else if(direction = 'r') then
  begin
    self.Top := (top * TSettings.BlockHeight) - TSettings.BorderWidth;
    self.Height := (height * TSettings.BlockWidth) + TSettings.BorderWidth;
    self.Left := ((left + 1) * TSettings.BlockWidth);
    self.Width := TSettings.BorderWidth;
  end
  else if(direction = 'r2') then
  begin
    self.Top := (top * TSettings.BlockHeight);
    self.Height := ((height + 1) * TSettings.BlockWidth) - TSettings.BorderWidth - TSettings.BorderWidth;
    self.Left := ((left + 1) * TSettings.BlockWidth);
    self.Width := TSettings.BorderWidth;
  end;

  self.BackgroundImage := System.Drawing.Image.FromFile('Theme\border.jpg');;
end;

end.
